import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-badges',
  templateUrl: './badges.page.html',
  styleUrls: ['./badges.page.scss'],
})
export class BadgesPage implements OnInit {

  constructor(
    private route : ActivatedRoute
  ) { }

  ngOnInit() {
  }
  public list:any[] = [];
  public totalNotification = 0;
  isClean = false;
  ngAfterViewInit(): void {
    this.route.queryParams.subscribe(
      (data:any)=>{
        // console.info(data);
        // if(!this.isClean){
        //   this.list = this.list.concat(data.list);
        //   this.totalNotification = data.number;
        // }
        let result:any = sessionStorage.getItem('data');
        result = JSON.parse(result);
        this.list = result.list;
        this.totalNotification = result.number;
      }
    );
  }

  cleanList(){
    this.list=[];
    this.totalNotification=0;
    this.isClean = true;
    sessionStorage.removeItem('data');
  }
}
